<!--继承基文件-->
{% extends "base.html" %}
{% load static %}
<!--标题-->
{% block title %} 用户列表 {% endblock title %}
{% block user %}{% if request.session.user %}{{ request.session.user }}{% else %} administrator{% endif %}{% endblock %}

<!--内容-->
{% block content %}
    <div class="right-product my-index right-full">
        <div class="container-fluid">
            <div class="info-center">
                {% include 'content_head.html' %}

                <div class="content-list">
                    <div class="row newslist" style="margin-top:20px;">
                        <div class="col-md-12">
                            <div class="panel panel-info mystyle-panel">
                                <div class="panel-heading">
                                    用户列表
                                    <div class="caret"></div>
                                    <a href="#" class="pull-right"><span class="glyphicon glyphicon-refresh"></span></a>
                                </div>
                                <div class="panel-body">
                                    <table class="table table-striped table-bordered table-hover">
                                        <tr class="mystyle info">
                                            <th>序号</th>
                                            <th>ID</th>
                                            <th>用户名</th>
                                            <th>性别</th>
                                            <th>年龄</th>
                                            <th>邮箱</th>
                                            <th>手机号</th>
                                            <th>用户类型</th>
                                            <th>创建时间</th>
                                            <th>查看</th>
                                            <th>操作</th>
                                        </tr>
                                        {% for user in user_list %}
                                            <tr>
                                                <td>{{ forloop.counter }}</td>
                                                <td>{{ user.id }}</td>
                                                <td>{{ user.username }}</td>
                                                <td>{% if user.gender == 'male' %}
                                                    男
                                                {% else %}
                                                    女
                                                {% endif %}
                                                </td>
                                                <td>{% if user.age != 0 %}
                                                    {{ user.age }}
                                                {% endif %}
                                                </td>
                                                <td>{{ user.email }}</td>
                                                <td>{{ user.phone }}</td>
                                                <td>{% if user.userType == 'admin' %}
                                                    管理员
                                                {% else %}
                                                    普通用户
                                                {% endif %}
                                                </td>
                                                <td>{{ user.createDateTime }}</td>
                                                <td><a href="{% url 'app01:show_serviceLine' pk=user.id %}"
                                                       class="btn btn-info">
                                                    查看{{ user.username }}负责的业务线</a></td>
                                                <td><a href="{% url 'app01:edit_user' pk=user.id %}"
                                                       style="color:rgb(51,122,183);">
                                                    <span class="glyphicon glyphicon-edit"></span></a>
                                                    <span style="padding: 0 10px;"></span>
                                                    <a href="{% url 'app01:del_user' pk=user.id %}" style="color: red;">
                                                        <span class="glyphicon glyphicon-trash"></span>
                                                    </a>
                                                </td>
                                            </tr>
                                        {% endfor %}
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock content %}
